package com.skywolf.chem.utils.sms;

import com.aliyuncs.profile.DefaultProfile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by pei_pei on 2020/6/28.
 */
@Configuration
@ConditionalOnClass({DefaultProfile.class})
@EnableConfigurationProperties({AliProperties.class})
public class AliySmsAutoConfig {

    @Autowired
    private AliProperties aliProperties;

    public AliySmsAutoConfig() {
    }

    @Bean
    public SendSms sendSms() {
        SendSms sendSms = new SendSms(this.aliProperties.getAccessKeyId(), this.aliProperties.getAccessSecret());
        return sendSms;
    }
}
